<?php

class phpinchains_util_DirTool
{
    
    function createRecursive ($dirarr, $basedir, $mod = 0755)
    {
        for ($i = 0; $i < count($dirarr); $i++)
        {
            if (!$dirarr[$i]) continue;
            $basedir .= '/'.$dirarr[$i];
            if (!file_exists($basedir)) mkdir($basedir, $mod);
        }
    }
    
    function createDirToFile ($filename, $basedir, $mod = 0755)
    {
        $path = explode('/', $filename);
        if (count($path>1))
        {
            array_pop($path);
            phpinchains_util_DirTool::createRecursive($path, $basedir, $mod);
        }    
    }
    
}

?>
